﻿@model IEnumerable<IGrouping<int, IGrouping<ArchiveMonth, PostInfo>>>
@{
    this.ViewBag.Title = "Archive";
}

@section ScriptSection
{
    <script type="text/javascript">
        $(document).ready(
			function () {
			    $('#archive').simpletree({
			        expandAll: false,
			        expandFirstItem: true,
			        expandFirstLevel: true
			    });
			});
    </script>
}

<div class="content">
    <h1>Archive</h1>
    <ul id="archive">
        @foreach (IGrouping<int, IGrouping<ArchiveMonth, PostInfo>> group1 in this.Model)
        {
            <li>
                @group1.Key
                <ul>
                    @foreach (IGrouping<ArchiveMonth, PostInfo> group2 in group1)
                    {
                        <li>
                            @group2.Key.MonthName
                            <ul>
                                @foreach (PostInfo postInfo in group2)
                                {
                                    <li>@this.Html.ActionLink(postInfo.Title, "Index", "Post", new { id = postInfo.FileID }, null)</li>
                                }
                            </ul>
                        </li>
                    }
                </ul>
            </li>
        }
    </ul>
</div>

